import React, { Component } from 'react'
import Login from "../page/login"
import Main from "../page/Main"
import Water from "../page/water"
import Video from "../page/video"
import { HashRouter as Router, Route, Switch, Redirect, Link } from "react-router-dom"
import { useTranslation } from 'react-i18next'

export default class routerviews extends Component<any, any> {
    constructor(props: any) {
        super(props)
        this.state = {
            list: [
                {
                    path: "/",
                    component: Login,
                    exact: true
                },
                {
                    path: "/login",
                    component: Login
                },
                {
                    path: "/main",
                    component: Main
                }, {
                    path: "/water",
                    component: Water
                },
                {
                    path: "/video",
                    component: Video
                }
            ]
        }
    }
    render() {

        return (
            <div>
                <Router>
                    {/* <div>
                        <Link to="/">首页</Link>|
                        <Link to="/water">可视化</Link>|
                    </div> */}
                    <Switch>
                        {this.state.list.map((item: any) => {
                            return (<Route key={item} path={item.path} component={item.component} exact={item.exact}></Route>)
                        })}
                    </Switch>
                </Router>

            </div>
        )
    }
}
